/**
 * 
 */
package org.gpp.proj1.robot.action.parser;

import java.io.IOException;

import org.gpp.proj1.util.test.JMETestCase;

/**
 * 
 * @author Gustavo de Farias
 */
public class ActionFileParserTest extends JMETestCase {


	/**
	 * Test method for {@link org.gpp.proj1.robot.action.parser.ActionFileParser#parseFile(java.lang.String)}.
	 */
	public void testParseFile() {
				
		try {
			ActionFileParser.parseFile("./test/action/burstShot.acs" );
		} catch (Exception e) {
			e.printStackTrace();
			fail("burstShot.acs exists and is well formed. Exception: " + e.getMessage());
		}
		
		try {
			ActionFileParser.parseFile("./test/action/singleShot.acs" );
		} catch (Exception e) {
			fail("singleShot.acs exists and is well formed.");
		}
		
		try {
			ActionFileParser.parseFile("NonExistent.acs" );
			fail("Should throw exception.");
		} catch (Exception e) {
			// good
		}
		
		try {
			ActionFileParser.parseFile("./test/action/malformed1.acs" );
			fail("Should throw exception.");
		} catch (MalformedActionScriptException e) {
			// good
		} catch (IOException e) {
			fail("Not this type of exception.");
		}
		
		try {
			ActionFileParser.parseFile("./test/action/malformed2.acs" );
			fail("Should throw exception.");
		} catch (MalformedActionScriptException e) {
			// good
		} catch (IOException e) {
			fail("Not this type of exception.");
		}
		
		try {
			ActionFileParser.parseFile("./test/action/malformed3.acs" );
			fail("Should throw exception.");
		} catch (MalformedActionScriptException e) {
			// good
		} catch (IOException e) {
			fail("Not this type of exception.");
		}
		
		try {
			ActionFileParser.parseFile("./test/action/malformed4.acs" );
			fail("Should throw exception.");
		} catch (MalformedActionScriptException e) {
			// good
		} catch (IOException e) {
			fail("Not this type of exception.");
		}
		
		try {
			ActionFileParser.parseFile("./test/action/malformed5.acs" );
			fail("Should throw exception.");
		} catch (MalformedActionScriptException e) {
			// good
		} catch (IOException e) {
			fail("Not this type of exception.");
		}
		
		try {
			ActionFileParser.parseFile("./test/action/wellformed1.acs" );
		} catch (Exception e) {
			fail("It is well formed.");
		}
		
		try {
			ActionFileParser.parseFile("./test/action/wellformed2.acs" );
		} catch (Exception e) {
			fail("It is well formed.");
		}
		
		try {
			ActionFileParser.parseFile("./test/action/wellformed3.acs" );
		} catch (Exception e) {
			fail("It is well formed.");
		}
	}
}